package vn.edu.thptduongbachmai.handlers.ajax;

import com.vng.zing.logger.ZLogger;
import com.vng.zing.stats.Profiler;
import com.vng.zing.stats.ThreadProfiler;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger;
import vn.edu.thptduongbachmai.handlers.BaseHandler;
import vn.edu.thptduongbachmai.model.SignUpModel;

/**
 *
 * @author tiennv4
 */
public class AjaxSignUpHandler extends BaseHandler {

	private static final Logger _Logger = ZLogger.getLogger(AjaxSignUpHandler.class);

	@Override
	protected void service(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException {
		if ("GET".equals(req.getMethod())) {
			this.doGet(req, resp);
		} else if ("POST".equals(req.getMethod())) {
			this.doPost(req, resp);
		}
	}

	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) {
		this.doProcess(req, resp);
	}

	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) {
		this.doProcess(req, resp);
	}

	private void doProcess(HttpServletRequest req, HttpServletResponse resp) {
		ThreadProfiler profiler = Profiler.createThreadProfilerInHttpProc("LoginHandler", req);
		try {
			//SignUpModel.Instance.process(req, resp);
		} catch (Exception ex) {
			_Logger.error(ex.getMessage(), ex);
		} finally {
			Profiler.closeThreadProfiler();
		}
	}
}
